<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "payment".
 *
 * @property integer $payment_id
 * @property integer $acc_pay_add_id
 * @property integer $amount
 * @property string $description
 *
 * @property AccPayAddress $accPayAdd
 */
class Payment extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'payment';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['acc_pay_add_id', 'description'], 'required'],
            [['acc_pay_add_id', 'amount', 'status'], 'integer'],
            [['description'], 'string']
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'payment_id' => 'Payment ID',
            'acc_pay_add_id' => 'Tài khoản nhận thanh toán',
            'amount' => 'Số tiền đã thanh toán',
            'description' => 'Ghi chú',
            'status' => 'Trạng thái',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getAccPayAdd()
    {
        return $this->hasOne(AccPayAddress::className(), ['acc_pay_address_id' => 'acc_pay_add_id']);
    }
}
